//
//  ASSession+Team.m
//  AppleAuth
//
//  Created by 吴双 on 2023/1/23.
//

#import "ASSession+Team.h"
#import "ASSession+Private.h"
#import <AltSign/AltSign.h>

@implementation ASAccountSession (Team)

- (void)fetchTeams:(void (^)(NSArray<ALTTeam *> *, NSError *))completion {
    [[ALTAppleAPI sharedAPI] fetchTeamsForAccount:self.account session:self.session
                                completionHandler:^(NSArray<ALTTeam *> * _Nullable teams, NSError * _Nullable error) {
        if (!error) {
            self.teams = teams;
        }
        !completion ?: completion(teams, error);
    }];
}

@end
